#include <iostream>
#include<vector>
#include<numeric>
using namespace std;
struct DSU
{
    vector<int> f, siz;
    DSU() {}
    DSU(int x)
    {
        init(x);
    }
    void init(int x) {
        f.resize(x);
        iota(f.begin(), f.end(), 0);
        siz.assign(x, 1);
    }
    int find(int x)
    {
        while (x != f[x])
        {
            x = f[x] = f[f[x]];
        }
        return x;
    }
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
    bool marge(int x, int  y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
        {
            return  false;
        }
        siz[x] += siz[y];
        f[y] = x;
        return true;
    }
    int size(int x)
    {
        return  siz[find(x)];
    }
};
int main()
{
    int n, m;
    cin >> n >> m;
    DSU cz(n + 1);

    int u, v;
    while (m--)
    {
        cin >> u >> v;
        cz.marge(u, v);
    }
    int max1 = 0x3f3f3f3f;
    for (int i = 1; i <= n; i++)
    {
        max1 = min(max1, cz.size(i));
    }
    cout << max1 << endl;
    return 0;
}
